import router from './index'
/**
 * 路由守卫
 */
router.beforeEach((to, from, next) => {
  // 抓取未匹配路径
  if (to.matched.length === 0) {
    next('/pages/error')
  } else {
    // 路由发生变化修改页面title
    if (to.meta.title) {
      document.title = to.meta.title
    }
    next()
  }
})